package com.spzx.user.api.fallback;

import com.spzx.common.core.domain.R;
import com.spzx.user.api.UserAddressFeignClient;
import com.spzx.user.api.domain.UserAddress;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

/**
 * @ClassName UserAddressFeignClientFallbackFactory
 * @Author 波
 * @Date 2024/8/12 17:54
 */
@Slf4j
public class UserAddressFeignClientFallbackFactory implements FallbackFactory<UserAddressFeignClient> {
    @Override
    public UserAddressFeignClient create(Throwable cause) {
        return new UserAddressFeignClient() {
            @Override
            public R<UserAddress> selectUserAddressById(Long userAddressId, String source) {
                log.error("获取用户地址信息失败:"+cause.getMessage());
                return R.fail("获取用户地址信息失败:" + cause.getMessage());
            }
        };
    }
}
